package com.qrxl.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qrxl.user.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色表 Mapper 接口
 * </p>
 *
 * @author friday
 * @since 2020-12-05
 */
public interface RoleMapper extends BaseMapper<Role> {
    /**
     * 查询用户关联的角色
     *
     * @param loginId
     * @return
     */
    @Select("SELECT id,name,type FROM role WHERE id in(SELECT role_id FROM user_role WHERE user_id=${loginId})")
    List<Role> selectListByUserId(@Param("loginId") String loginId);
}
